//
//  OMServiceRulesViewController.m
//  OMENGO_NEW
//
//  Created by 梁尚嘉 on 2017/5/19.
//  Copyright © 2017年 Kamfat. All rights reserved.
//

#import "OMServiceRulesViewController.h"
#import <YYText.h>
@interface OMServiceRulesViewController ()
@property (nonatomic, strong) YYTextView *textView;
@end

@implementation OMServiceRulesViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.title = @"服条条款";

    ///文字容器初始化
    _textView = [YYTextView new];
    _textView.font = SM_CFont(28);
    _textView.editable = NO;
    _textView.showsVerticalScrollIndicator = NO;
    [self.view addSubview:_textView];
    [_textView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(@0);
        make.left.equalTo(@(SM_SIZE(20)));
        make.right.equalTo(@(SM_SIZE(-20)));
        make.top.equalTo(self.navigationBar.mas_bottom);
    }];

    ///数据实始化
    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
        NSString *path = [[NSBundle mainBundle]pathForResource:@"ServiceRules" ofType:nil];
        NSString *contents = [[NSString alloc]initWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil];
        NSMutableAttributedString *att = [[NSMutableAttributedString alloc]initWithString:contents];
        att.yy_lineSpacing = SM_SIZE(5);
        att.yy_kern = @(SM_SIZE(2));
        att.yy_paragraphSpacing = SM_SIZE(30);
        NSRange rang = [att.string rangeOfString:@"邻檬圈智能手机应用平台用户服务协议"];
        [att yy_setFont:SM_CBFont(33) range:rang];
        dispatch_async(dispatch_get_main_queue(), ^{

            self.textView.attributedText = att;

        });
    });
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
